import React, { Component } from 'react';
import { NavLink, Link, BrowserRouter, Route } from 'react-router-dom';
// 路由组件，接收到路由器发送的history, location，match固定的
import Home from './pages/Home';
import About from './pages/About';
// 一般组件，能接收到props，父给什么就接什么
import Header from './components/Header';
import MyNavLink from './components/MyNavLink';

export default class App extends Component {
    
    render() {
        // const {users} = this.state
        return (
            <div>
                <div className="row">
                    <div className="col-xs-offset-2 col-xs-8">
                        <Header />
                    </div>
                </div>
                <div className="row">
                    <div className="col-xs-2 col-xs-offset-2">
                        <div className="list-group">
                            {/* 原生html靠<a>跳转页面
                                <a className="list-group-item active" href="./about.html">About</a>
                                <a className="list-group-item" href="./home.html">Home</a> 
                            */}

                            {/* react中靠路由链接切组件，编写路由链接 */}
                            <MyNavLink to="/about">About</MyNavLink>
                            <MyNavLink to="/home">Home</MyNavLink>
                        </div>
                    </div>
                    <div className="col-xs-6">
                        <div className="panel">
                            <div className="panel-body">
                                {/* 注册路由 */}
                                <Route path='/about' component={About}/>
                                <Route path='/Home' component={Home} />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        );
    }
}
